package com.jin;

import com.jin.工厂模式.简单工厂模式.顺从.service.ICommodity;
import com.jin.工厂模式.简单工厂模式.顺从.service.Impl.CouponCommodityService;
import com.jin.工厂模式.简单工厂模式.顺从.service.StoreFactory;
import org.junit.Test;

import java.util.HashMap;

public class test_StoreFactory_01 {
    @Test
    public void test_StoreFactory_01() throws Exception {
        StoreFactory storeFactory = new StoreFactory();

        // 1. 优惠券
        ICommodity commodityService_1 = storeFactory.getCommodityService(1);
        commodityService_1.sendCommodity("10001", "EGM1023938910232121323432", "791098764902132", null);

        // 2. 实物商品
        ICommodity commodityService_2 = storeFactory.getCommodityService(2);
        commodityService_2.sendCommodity("10001", "9820198721311", "1023000020112221113", new HashMap<String, String>() {{
            put("consigneeUserName", "艾尼路");
            put("consigneeUserPhone", "15200292123");
            put("consigneeUserAddress", "风车村");
        }});

        // 3. 第三方兑换卡(模拟爱奇艺)
        ICommodity commodityService_3 = storeFactory.getCommodityService(3);
        commodityService_3.sendCommodity("10001", "AQY1xjkUodl8LO975GdfrYUio", null, null);
    }
    @Test
    public void test_StoreFactory_02() throws Exception {
        StoreFactory storeFactory = new StoreFactory();
        ICommodity commodityService = storeFactory.getCommodityService(CouponCommodityService.class);
        commodityService.sendCommodity("165616","1561651849","48961",null);
    }
}
